/**
 * 
 */
package br.ufal.ic.sd.project.server.enumeration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author keven andrade
 *
 */
public enum ServiceType {
    
    LOGGER(1,"LOGGER"),
    TOKEN(2,"TOKEN"),
    REPLICATION(3,"REPLICATION");
    
    private int intId;
    private String strDescription;
    
    /**
     * @Construtor
     * @param intId
     * @param strLogName
     */
    private ServiceType(int intId, String strLogName) {
	
	this.intId = intId;
	this.strDescription = strLogName;
	
    }
    
    /**
     * @return a list of ServiceType
     */
    public static List<ServiceType> getListCommand() {

	List<ServiceType> listServiceType = new ArrayList<ServiceType>();
	int i = 1;

	while (ServiceType.getCommand(i) != null) {
	    listServiceType.add(ServiceType.getCommand(i++));
	}
	return listServiceType;
    }
    
    /**
     * @return a ServiceType by is id
    */
    public static ServiceType getCommand(int intId) {
	
	switch (intId) {
		case 1:
		    return ServiceType.LOGGER;
		case 2:
		    return ServiceType.TOKEN;
		case 3:
		    return ServiceType.REPLICATION;
		default:
		    return null;
	}
    }

    /**
     * @return the intId
     */
    protected int getIntId() {
        return intId;
    }

    /**
     * @param intId the intId to set
     */
    protected void setIntId(int intId) {
        this.intId = intId;
    }

    /**
     * @return the strDescription
     */
    public String getStrDescription() {
        return strDescription;
    }

    /**
     * @param strDescription the strDescription to set
     */
    public void setStrDescription(String strDescription) {
        this.strDescription = strDescription;
    }

}
